﻿using System.Web.UI;

namespace ElectronicCommerce.Framework.Web.UI.Extensions
{
    public static class PageExtensions
    {
        public static string GetFromQueryString(this Page page, string key)
        {
            return ECContext.Current.GetFromQueryString(key);
        }

        public static T GetFromQueryString<T>(this Page page, string key)
        {
            return ECContext.Current.GetFromForm<T>(key);
        }

        public static T GetFromQueryString<T>(this Page page, string key, T defaultValue)
        {
            return ECContext.Current.GetFromQueryString<T>(key, defaultValue);
        }

        public static string GetFromForm(this Page page, string key)
        {
            return ECContext.Current.GetFromForm(key);
        }

        public static T GetFromForm<T>(this Page page, string key)
        {
            return ECContext.Current.GetFromForm<T>(key);
        }

        public static T GetFromForm<T>(this Page page, string key, T defaultValue)
        {
            return ECContext.Current.GetFromForm<T>(key, defaultValue);
        }

        public static string GetFromRequest(this Page page, string key)
        {
            return ECContext.Current.GetFromRequest(key);
        }

        public static T GetFromRequest<T>(this Page page, string key)
        {
            return ECContext.Current.GetFromRequest<T>(key);
        }

        public static T GetFromRequest<T>(this Page page, string key, T defaultValue)
        {
            return ECContext.Current.GetFromRequest<T>(key, defaultValue);
        }
    }
}
